import logging
import os

from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from openai import OpenAI

# 配置日志打印级别
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)

# 读取env配置信息
load_dotenv(override=True)

# LLM_API_KEY配置
# deepSeek
deepseek_api_key = os.getenv("DEEPSEEK_API_KEY")
# 智谱
zhipu_api_key = os.getenv("ZHIPU_API_KEY")

# OPEN_AI框架-创建智谱AI客户端
zhipu_openai_llm = OpenAI(
    api_key=zhipu_api_key,
    base_url="https://open.bigmodel.cn/api/paas/v4/"
)

# LangChain框架-创建智谱AI客户端
zhipu_langchain_llm = ChatOpenAI(
    temperature=0.6,
    model="glm-4.6",
    openai_api_key=zhipu_api_key,
    openai_api_base="https://open.bigmodel.cn/api/paas/v4/"
)
